package com.example.win.android_banduyujia.peopleactivity.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.win.android_banduyujia.R;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * Created by Win on 2015/9/2.
 */
public class AccoutAdapter extends BaseAdapter {

    public ArrayList<HashMap<String, String>>   list;
    public Context   context;
    public LayoutInflater   Inflater;

    public AccoutAdapter(Context context, ArrayList<HashMap<String, String>> list) {
            this.context = context;
            this.list = list;
            Inflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        if(null != list){
            return  list.size();
        }
        return 0;
    }

    @Override
    public Object getItem(int position) {
        if(null != list){
            return  list.get(position);
        }
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = null;
        ViewHolder  viewHolder=null;
        if(convertView == null){
            view = Inflater.inflate(R.layout.view_list_item_accout_balance, null);
            viewHolder = new ViewHolder();
            view.setTag(viewHolder);
        }else{
            view = convertView;
            viewHolder = (ViewHolder) view.getTag();

        }
        return view;
    }

    public static class ViewHolder{
        TextView  viewHolder;
    }
}
